﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using MvcVehicleInsurance.Models;

namespace MvcVehicleInsurance.Areas.Admin.Controllers
{
    public class LoginController : Controller
    {
        //
        // GET: /Admin/Login/

        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        public ActionResult Index(string Acc_Username, string Acc_Password)
        {
            Account acm = new Account();
            Account ac = acm.DangnhapAdmin(Acc_Username, Acc_Password);
            if (ac != null)
            {
                this.Session["Admin"] = "login ok";
                Response.Redirect("/Admin/Account/");

            }
            else
            {
                ViewData["message"] = "User Name Not Connect";
                return View();
            }
            return View();

        }
        public ActionResult XulyLogin(string Acc_Username, string Acc_Password)
        {
            Account acm = new Account();
            Account ac = acm.DangnhapAdmin(Acc_Username , Acc_Password);
            if(ac != null)
            {
                Session["Account"] = ac;
                Response.Redirect("Index");
                
            }
            else
            {
                ViewData["message"] = "User Name Not Connect";
                Response.Redirect("Login");
            }
            return View();

        }

    }
}
